import os
from fastapi import APIRouter, Request
from utils.tools import find_process_path, is_blank
from components.log import log
from utils.resp import resp_err, resp_ok

ping_router = APIRouter()


@ping_router.get("/ping")
async def ping():
    log.info("ping called")
    pong = os.getenv("PONG_MSG", "pong")
    
    return resp_ok(pong)




@ping_router.post("/ps_info")
async def ps_info(request: Request):
    query_params = request.query_params
    name = query_params.get("name")
    
    return resp_ok(find_process_path(name))
